Xbasic

SortList_On_ReferenceList Function

Syntax

Sorted_List as C = SortList_On_ReferenceList(C list ,C reference_list )

Arguments

Sorted_List

The resulting sorted list.

list

The original unsorted list.

reference_list

The list that defines the sort sequence to be applied.

Description

Sorts a CRLF delimited list so that the entries are in the same order as the entries in a reference list

Discussion

The SortList_On_ReferenceList() function allows you to sort a list in a manner defined by a Reference_List. The Reference_List must contain the entries found in List or they will not be sorted.

Example

In this example list_all contains j, c, and z.

list_all = <<%a%
a
z
c
b
j
%a%
list_selected = comma_to_crlf("j,c,z")
? SortList_On_ReferenceList(list_selected,list_all)
= z
c
j

In this example list_all contains only j.

list_all = <<%a%
a
z
c
b
j
%a%
list_selected = comma_to_crlf("j,ce,za")
? SortList_On_ReferenceList(list_selected,list_all)
= j

See Also